package cate.game.role.mall.refresh;

import cate.game.role.Role;
import cate.game.role.RoleDependent;
import cate.game.role.mall.refresh.impl.IFreeRefresh;
import cate.game.role.mall.refresh.item.FreeRefreshItem;
import cate.game.role.mall.refresh.item.RefreshItem;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

public abstract class FreeRefresh extends RoleDependent implements IFreeRefresh {
    public FreeRefreshItem free;

    @Override
    public void initialize(Role role) {
        super.initialize(role);
        if (free == null) {
            free = new FreeRefreshItem();
        }
    }

    @Override
    @JsonIgnore
    public RefreshItem getFreeRefreshItem() {
        return free;
    }

    public abstract void checkRefreshTime();

    @JsonProperty("freeTimes")
    public int getFreeTimes() {
        return free.times;
    }

    @JsonProperty("lastFreeRefreshTime")
    public long getLastFreeRefreshTime() {
        return free.lastRefreshTime;
    }
}
